home *** CD-ROM | disk | FTP | other *** search
/ Motor Sport Digital Archive Collection 1960s / Motor Sport Digital Archive Collection 1960s.iso / main.swf / scripts / views / Spread.as < prev    next >
Encoding:
Text File  |  2008-05-21  |  7.2 KB  |  252 lines

  1. package views
  2. {
  3.    import flash.accessibility.*;
  4.    import flash.debugger.*;
  5.    import flash.display.*;
  6.    import flash.errors.*;
  7.    import flash.events.*;
  8.    import flash.external.*;
  9.    import flash.filters.*;
  10.    import flash.geom.*;
  11.    import flash.media.*;
  12.    import flash.net.*;
  13.    import flash.printing.*;
  14.    import flash.profiler.*;
  15.    import flash.system.*;
  16.    import flash.text.*;
  17.    import flash.ui.*;
  18.    import flash.utils.*;
  19.    import flash.xml.*;
  20.    import mx.binding.*;
  21.    import mx.containers.Canvas;
  22.    import mx.controls.Image;
  23.    import mx.core.UIComponentDescriptor;
  24.    import mx.core.mx_internal;
  25.    import mx.events.PropertyChangeEvent;
  26.    import mx.styles.*;
  27.    
  28.    public class Spread extends Canvas
  29.    {
  30.       private static var _watcherSetupUtil:IWatcherSetupUtil;
  31.       
  32.       private var _bindings:Array;
  33.       
  34.       public var _bindingsByDestination:Object;
  35.       
  36.       public var _bindingsBeginWithWord:Object;
  37.       
  38.       [Bindable]
  39.       private var _859611628imageURL:String;
  40.       
  41.       [Bindable]
  42.       private var _1302779216spreadImg:Image;
  43.       
  44.       private var mxHeight:int = 934;
  45.       
  46.       private var mxWidth:int = 1280;
  47.       
  48.       private var _watchers:Array;
  49.       
  50.       [Bindable]
  51.       private var _94852023cover:int = 0;
  52.       
  53.       private var _documentDescriptor_:UIComponentDescriptor;
  54.       
  55.       public function Spread()
  56.       {
  57.          _documentDescriptor_ = new UIComponentDescriptor({
  58.             "type":Canvas,
  59.             "propertiesFactory":function():Object
  60.             {
  61.                return {"childDescriptors":[new UIComponentDescriptor({
  62.                   "type":Image,
  63.                   "id":"spreadImg",
  64.                   "events":{"init":"__spreadImg_init"},
  65.                   "propertiesFactory":function():Object
  66.                   {
  67.                      return {
  68.                         "showBusyCursor":true,
  69.                         "percentWidth":100,
  70.                         "percentHeight":100
  71.                      };
  72.                   }
  73.                })]};
  74.             }
  75.          });
  76.          _94852023cover = 0;
  77.          mxWidth = 1280;
  78.          mxHeight = 934;
  79.          super();
  80.          mx_internal::_document = this;
  81.          if(!this.styleDeclaration)
  82.          {
  83.             this.styleDeclaration = new CSSStyleDeclaration();
  84.          }
  85.          this.styleDeclaration.defaultFactory = function():void
  86.          {
  87.             this.horizontalCenter = 0;
  88.             this.verticalCenter = 0;
  89.          };
  90.          this.percentWidth = 97;
  91.          this.percentHeight = 97;
  92.       }
  93.       
  94.       public static function set watcherSetupUtil(param1:IWatcherSetupUtil) : void
  95.       {
  96.          Spread._watcherSetupUtil = param1;
  97.       }
  98.       
  99.       public function set imageURL(param1:String) : void
  100.       {
  101.          var _loc2_:Object = null;
  102.          _loc2_ = this._859611628imageURL;
  103.          if(_loc2_ !== param1)
  104.          {
  105.             this._859611628imageURL = param1;
  106.             dispatchEvent(PropertyChangeEvent.createUpdateEvent(this,"imageURL",_loc2_,param1));
  107.          }
  108.       }
  109.       
  110.       private function imageInit(param1:Event) : void
  111.       {
  112.          var _loc2_:int = 0;
  113.          var _loc3_:int = 0;
  114.          var _loc4_:Number = NaN;
  115.          var _loc5_:Number = NaN;
  116.          var _loc6_:int = 0;
  117.          var _loc7_:int = 0;
  118.          var _loc8_:int = 0;
  119.          var _loc9_:int = 0;
  120.          if(0 == cover)
  121.          {
  122.             this.width = mxWidth;
  123.             this.height = mxHeight;
  124.          }
  125.          else
  126.          {
  127.             this.width = mxWidth * 0.97;
  128.             this.height = mxHeight * 0.97;
  129.          }
  130.          _loc2_ = int(param1.target.contentWidth);
  131.          _loc3_ = int(param1.target.contentHeight);
  132.          _loc4_ = this.width / _loc2_;
  133.          _loc5_ = this.height / _loc3_;
  134.          if(_loc4_ < _loc5_)
  135.          {
  136.             _loc6_ = _loc4_ * _loc2_;
  137.             _loc7_ = _loc4_ * _loc3_;
  138.          }
  139.          else
  140.          {
  141.             _loc6_ = _loc5_ * _loc2_;
  142.             _loc7_ = _loc5_ * _loc3_;
  143.          }
  144.          _loc8_ = (this.width - _loc6_) / 2;
  145.          _loc9_ = (this.height - _loc7_) / 2;
  146.          param1.target.x = _loc8_;
  147.          param1.target.y = _loc9_;
  148.       }
  149.       
  150.       [Bindable(event="propertyChange")]
  151.       public function get spreadImg() : Image
  152.       {
  153.          return this._1302779216spreadImg;
  154.       }
  155.       
  156.       private function _Spread_bindingsSetup() : void
  157.       {
  158.          var binding:Binding = null;
  159.          if(!_bindings)
  160.          {
  161.             _bindings = [];
  162.          }
  163.          if(!_watchers)
  164.          {
  165.             _watchers = [];
  166.          }
  167.          binding = new Binding(this,function():Array
  168.          {
  169.             return [new GlowFilter(0,1,12,10,1,2)];
  170.          },function(param1:Array):void
  171.          {
  172.             spreadImg.filters = param1;
  173.          },"spreadImg.filters");
  174.          _bindings[0] = binding;
  175.          binding = new Binding(this,function():Object
  176.          {
  177.             return "images/large/" + imageURL;
  178.          },function(param1:Object):void
  179.          {
  180.             spreadImg.source = param1;
  181.          },"spreadImg.source");
  182.          _bindings[1] = binding;
  183.       }
  184.       
  185.       private function _Spread_bindingExprs() : void
  186.       {
  187.          var _loc1_:* = undefined;
  188.          _loc1_ = [new GlowFilter(0,1,12,10,1,2)];
  189.          _loc1_ = "images/large/" + imageURL;
  190.       }
  191.       
  192.       [Bindable(event="propertyChange")]
  193.       public function get imageURL() : String
  194.       {
  195.          return this._859611628imageURL;
  196.       }
  197.       
  198.       public function __spreadImg_init(param1:Event) : void
  199.       {
  200.          imageInit(param1);
  201.       }
  202.       
  203.       public function set spreadImg(param1:Image) : void
  204.       {
  205.          var _loc2_:Object = null;
  206.          _loc2_ = this._1302779216spreadImg;
  207.          if(_loc2_ !== param1)
  208.          {
  209.             this._1302779216spreadImg = param1;
  210.             dispatchEvent(PropertyChangeEvent.createUpdateEvent(this,"spreadImg",_loc2_,param1));
  211.          }
  212.       }
  213.       
  214.       public function set cover(param1:int) : void
  215.       {
  216.          var _loc2_:Object = null;
  217.          _loc2_ = this._94852023cover;
  218.          if(_loc2_ !== param1)
  219.          {
  220.             this._94852023cover = param1;
  221.             dispatchEvent(PropertyChangeEvent.createUpdateEvent(this,"cover",_loc2_,param1));
  222.          }
  223.       }
  224.       
  225.       override public function initialize() : void
  226.       {
  227.          var target:Spread = null;
  228.          var watcherSetupUtilClass:Object = null;
  229.          mx_internal::setDocumentDescriptor(_documentDescriptor_);
  230.          _Spread_bindingsSetup();
  231.          target = this;
  232.          if(_watcherSetupUtil == null)
  233.          {
  234.             watcherSetupUtilClass = getDefinitionByName("_views_SpreadWatcherSetupUtil");
  235.             watcherSetupUtilClass["init"](null);
  236.          }
  237.          _watcherSetupUtil.setup(this,function(param1:String):*
  238.          {
  239.             return target[param1];
  240.          },_bindings,_watchers);
  241.          super.initialize();
  242.       }
  243.       
  244.       [Bindable(event="propertyChange")]
  245.       public function get cover() : int
  246.       {
  247.          return this._94852023cover;
  248.       }
  249.    }
  250. }
  251.  
  252.